----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
      name:  <unnamed>
       log:  F:/Dropbox (UBC-Umich)/Research_Projects/Project Javier and Natalia/TFP firm/TFP_firm_data_historical/dataverse_files/code/logs/figure_04_phi_vs_z_manufserv.log
  log type:  text
 opened on:  16 Nov 2022, 21:07:18

. *-------------------------------------------------------------------------------
. 
. 
. 
. *-----------------------------------------------------------------
. clear all

. use "${data}/estimates_aggtype_naics_sales_s1_base_woparent.dta", clear

. 
. local grvar0 "LP_ppp_emp_pwt" 

. local grvar1 "" 

. local rr ""

. local var3 "A"

. local yy "2016"

. local yy_ref=`yy'       

. replace year=`yy_ref'
(0 real changes made)

. merge m:1 year isocode type using "${data}/aggregates_tfp_lp_klems_agg.dta" 
(note: variable year was float, now double to accommodate using data's values)
(note: variable isocode was str2, now str32 to accommodate using data's values)
(note: variable type was str6, now str9 to accommodate using data's values)

    Result                           # of obs.
    -----------------------------------------
    not matched                         2,931
        from master                         0  (_merge==1)
        from using                      2,931  (_merge==2)

    matched                                81  (_merge==3)
    -----------------------------------------

. drop if _merge==2
(2,931 observations deleted)

. drop _merge

. 
. foreach var in D_`var3'  {
  2. gen `var'_phi=(-1)*`var'*(0.2)
  3. *---------------------------------------
. gen b_`var'_phi_`grvar0'=ln_`grvar0' - `var'_phi
  4. }
(1 missing value generated)
(1 missing value generated)

. 
. local LHS1 D_`var3'_phi

. local LHS2 b_D_`var3'_phi_`grvar0'

. local RHS ln_`grvar0'

.         
.         
. foreach type in manuf serv {
  2. 
. display "`type'"
  3. sum `LHS1' `RHS'  `LHS2'
  4. local ytitle "{&Delta}`=ustrunescape("\u03D5\u0303")'{sub:n}, {&Delta}`=ustrunescape("\u007A\u0303")'{sub:n}"
  5. local xtitle "{&Delta}y{sub:n}"
  6. local firm_emb "{&Delta}`=ustrunescape("\u03D5\u0303")'{sub:n}" 
  7. local ctry_emb "{&Delta}`=ustrunescape("\u007A\u0303")'{sub:n}"
  8. 
. reg `LHS1' `RHS' if type=="`type'"
  9. mat b = e(b)
 10. mat V = e(V)
 11. global c1: display %-03.2fc round(b[1,1],0.01)
 12. global se1: display %-03.2fc round(sqrt(V[1,1]),0.01)
 13. 
. reg `LHS2' `RHS' if type=="`type'"
 14. mat b = e(b)
 15. mat V = e(V)
 16. global c2: display %-03.2fc round(b[1,1],0.01)
 17. global se2: display %-03.2fc round(sqrt(V[1,1]),0.01)
 18. 
. display $c1
 19. display $se1
 20. display $c2
 21. display $se2
 22. 
. 
. global opt1 msymbol(circle_hollow) mlabel(isocode) mlabcolor(red)  msize(small) mlabsize(small)
 23. global opt2 msymbol(square_hollow) mlabel(isocode) mlabcolor(blue) msize(small) mlabsize(small)
 24. two (scatter `LHS1' `RHS' if type=="`type'", sort $opt1  mcolor(red)) (lfit `LHS1' `RHS' if type=="`type'", lcolor(red)) (line `RHS' `RHS' if type=="`type'", lcolor(none))  
> ///
>         (scatter `LHS2' `RHS' if type=="`type'", sort $opt2  mcolor(blue)) (lfit `LHS2' `RHS' if type=="`type'", lcolor(blue)) (line `RHS' `RHS' if type=="`type'", lcolor(none)
> ),  ylabel(, format(%5.1f) labsize(medlarge)) xlabel(-1(0.2)0, format(%5.1f) labsize(medlarge)) ///
>         title("`title'", size(small)) ytitle("`ytitle'", size(medlarge)) xtitle("`xtitle'", size(medlarge)) graphregion(fcolor(white) lcolor(white)) ///
>         legend(order(2 "`firm_emb': $c1 ($se1)" 5 "`ctry_emb': $c2 ($se2)") rows(2) size(medlarge) bplace(se) ring(0) region(lwidth(none))) 
 25. graph export "${rmain}/fig_04_`type'.pdf", replace
 26. }       
manuf

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
     D_A_phi |         80   -.2301875    .1777735  -.6154568   .2956024
ln_LP_ppp_.. |         81   -.2767506    .3269977  -1.189091   .3206411
b_D_A_phi_~t |         80   -.0474933    .2796362  -.8363765   .5810399

      Source |       SS           df       MS      Number of obs   =        27
-------------+----------------------------------   F(1, 25)        =     15.60
       Model |   .46849958         1   .46849958   Prob > F        =    0.0006
    Residual |  .750985643        25  .030039426   R-squared       =    0.3842
-------------+----------------------------------   Adj R-squared   =    0.3595
       Total |  1.21948522        26  .046903278   Root MSE        =    .17332

-----------------------------------------------------------------------------------
          D_A_phi |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
------------------+----------------------------------------------------------------
ln_LP_ppp_emp_pwt |   .3434853    .086976     3.95   0.001     .1643549    .5226156
            _cons |  -.0598828   .0453138    -1.32   0.198    -.1532082    .0334427
-----------------------------------------------------------------------------------

      Source |       SS           df       MS      Number of obs   =        27
-------------+----------------------------------   F(1, 25)        =     56.98
       Model |  1.71151991         1  1.71151991   Prob > F        =    0.0000
    Residual |  .750985638        25  .030039426   R-squared       =    0.6950
-------------+----------------------------------   Adj R-squared   =    0.6828
       Total |  2.46250555        26  .094711752   Root MSE        =    .17332

-----------------------------------------------------------------------------------
b_D_A_phi_LP_pp~t |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
------------------+----------------------------------------------------------------
ln_LP_ppp_emp_pwt |   .6565147    .086976     7.55   0.000     .4773844    .8356451
            _cons |   .0598828   .0453138     1.32   0.198    -.0334427    .1532082
-----------------------------------------------------------------------------------
.34
.09
.66
.09
(file F:/Dropbox (UBC-Umich)/Research_Projects/Project Javier and Natalia/TFP firm/TFP_firm_data_historical/dataverse_files/results/main/fig_04_manuf.pdf written in PDF format)
serv

    Variable |        Obs        Mean    Std. Dev.       Min        Max
-------------+---------------------------------------------------------
     D_A_phi |         80   -.2301875    .1777735  -.6154568   .2956024
ln_LP_ppp_.. |         81   -.2767506    .3269977  -1.189091   .3206411
b_D_A_phi_~t |         80   -.0474933    .2796362  -.8363765   .5810399

      Source |       SS           df       MS      Number of obs   =        27
-------------+----------------------------------   F(1, 25)        =     11.86
       Model |  .132114333         1  .132114333   Prob > F        =    0.0020
    Residual |  .278439538        25  .011137582   R-squared       =    0.3218
-------------+----------------------------------   Adj R-squared   =    0.2947
       Total |  .410553871        26  .015790533   Root MSE        =    .10553

-----------------------------------------------------------------------------------
          D_A_phi |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
------------------+----------------------------------------------------------------
ln_LP_ppp_emp_pwt |   .3157702   .0916836     3.44   0.002     .1269443    .5045961
            _cons |  -.1340128   .0281175    -4.77   0.000     -.191922   -.0761037
-----------------------------------------------------------------------------------

      Source |       SS           df       MS      Number of obs   =        27
-------------+----------------------------------   F(1, 25)        =     55.70
       Model |  .620314191         1  .620314191   Prob > F        =    0.0000
    Residual |  .278439537        25  .011137581   R-squared       =    0.6902
-------------+----------------------------------   Adj R-squared   =    0.6778
       Total |  .898753728        26  .034567451   Root MSE        =    .10553

-----------------------------------------------------------------------------------
b_D_A_phi_LP_pp~t |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
------------------+----------------------------------------------------------------
ln_LP_ppp_emp_pwt |   .6842298   .0916836     7.46   0.000     .4954039    .8730557
            _cons |   .1340128   .0281175     4.77   0.000     .0761037     .191922
-----------------------------------------------------------------------------------
.32
.09
.68
.09
(file F:/Dropbox (UBC-Umich)/Research_Projects/Project Javier and Natalia/TFP firm/TFP_firm_data_historical/dataverse_files/results/main/fig_04_serv.pdf written in PDF format)

.         
.         
.         
.         
.         
.         
.         
.         
.         
. log close 
      name:  <unnamed>
       log:  F:/Dropbox (UBC-Umich)/Research_Projects/Project Javier and Natalia/TFP firm/TFP_firm_data_historical/dataverse_files/code/logs/figure_04_phi_vs_z_manufserv.log
  log type:  text
 closed on:  16 Nov 2022, 21:07:23
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
